package com.wing.sell.strategy.impl;

import com.wing.common.enums.ProductEnum;
import com.wing.sell.model.request.DeliveryRecordForm;
import com.wing.sell.model.response.FinishedOrderVo;
import com.wing.sell.model.response.OrderSkuDetailSearchVo;
import com.wing.sell.service.OrderService;
import com.wing.sell.strategy.SelOrder;
import com.wing.sell.strategy.SelOrderGenerateStrategy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Description:
 * @Project: szgc-enterprise-coding
 * @Package: com.wing.sell.strategy.impl.ProductOrderGenerate
 * @Date: 2024/12/16 10:42
 * @Author: heZhou
 * @Version: 1.0
 */
@Component
@SelOrder(type = "SCDC")
public class ProductOrderGenerate implements SelOrderGenerateStrategy {

    @Autowired
    private OrderService orderService;

    /**
     * 是否生成订单
     * @param type 类型
     * @return 是否匹配
     */
    @Override
    public boolean isGenerateOrder(String type) {
        if (type.equals(ProductEnum.outTypeEmum.SCDC.getCode())) {
            return true;
        }
        return false;
    }

    /**
     * 是否成功生成
     * @param deliveryRecordForm 入参
     * @return 生成结果
     */
    @Override
    public Integer generateOrderResult(DeliveryRecordForm deliveryRecordForm) {
        return orderService.generateOrderResult(deliveryRecordForm);
    }

    /**
     * 获取订单中sku详情
     * @param orderId 订单id
     * @return sku列表
     */
    @Override
    public List<OrderSkuDetailSearchVo> getDetailBy(Long orderId,Long warehouseId) {
        return orderService.listByInfo(orderId,warehouseId);
    }
}
